/*
 * @Author: your name
 * @Date: 2021-10-26 22:03:41
 * @LastEditTime: 2021-11-15 21:14:18
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \vue-vben-admin-main\src\main.ts
 */
import '/@/design/index.less';
import 'virtual:windi-base.css';
import 'virtual:windi-components.css';
import 'virtual:windi-utilities.css';
// Register icon sprite
import 'virtual:svg-icons-register';
import App from './App.vue';
import { createApp } from 'vue';
import { initAppConfigStore } from '/@/logics/initAppConfig';
import { setupErrorHandle } from '/@/logics/error-handle';
import { router, setupRouter } from '/@/router';
import { setupRouterGuard } from '/@/router/guard';
import { setupStore } from '/@/store';
import { setupGlobDirectives } from '/@/directives';
import { setupI18n } from '/@/locales/setupI18n';
import { registerGlobComp } from '/@/components/registerGlobComp';
// import { dropPrefix } from 'vite-plugin-theme';
import { dropPrefix } from 'vite-plugin-theme/es/colorUtils';
import LoginFormTitleVue from './views/sys/login/LoginFormTitle.vue';


// import { configStyleImportPlugin } from 'build/vite/plugin/styleImport';

// Importing on demand in local development will increase the number of browser requests by around 20%.
// This may slow down the browser refresh speed.
// Therefore, only enable on-demand importing in production environments .
if (import.meta.env.DEV) {
    import('ant-design-vue/dist/antd.less');
}

async function bootstrap() {
    
    const app = createApp(App);

    // Configure store
    setupStore(app);
    
    // Initialize internal system configuration
    initAppConfigStore();

    // Register global components,主要是一些antd的全局化需要的组件
    registerGlobComp(app);
    
    // Multilingual configuration
    // Asynchronous case: language files may be obtained from the server side
    await setupI18n(app);
    
    // Configure routing
    setupRouter(app);
    
    // router-guard,权限判断,初始化缓存数据
    setupRouterGuard(router);
    
    // Register global directive
    setupGlobDirectives(app);
    
    // Configure global error handling
    setupErrorHandle(app);
    
    // https://next.router.vuejs.org/api/#isready
    // await router.isReady();
    
    // vm 一般这个成为vm对象,本质类型上是一个proxy
    const vm = app.mount('#app');
    // console.log(vm.$.vnode.component === vm.$ );
    
    
    
}

bootstrap();
